# Copyright (c) 2023 HPMicro
# SPDX-License-Identifier: BSD-3-Clause

# Check FILEX dependency
set(NEED_CHECK_FILEX 0)
if (DEFINED CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_FTP)
    set(NEED_CHECK_FILEX 1)
endif()

if (DEFINED CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_HTTP)
    set(NEED_CHECK_FILEX 1)
endif()

if (NX_HTTP_NO_FILEX)
    set(NEED_CHECK_FILEX 0)
endif()

if (${NEED_CHECK_FILEX})
    if (NOT DEFINED CONFIG_ECLIPSE_THREADX_FILEX)
        message(FATAL_ERROR "CONFIG_ECLIPSE_THREADX_FILEX must be defined when defined CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS")
    endif()
endif()

add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_AUTO_IP ${CMAKE_CURRENT_LIST_DIR}/auto_ip)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_BSD ${CMAKE_CURRENT_LIST_DIR}/BSD)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_CLOUD ${CMAKE_CURRENT_LIST_DIR}/cloud)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_DHCP ${CMAKE_CURRENT_LIST_DIR}/dhcp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_DNS ${CMAKE_CURRENT_LIST_DIR}/dns)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_FTP ${CMAKE_CURRENT_LIST_DIR}/ftp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_HTTP ${CMAKE_CURRENT_LIST_DIR}/http)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_LWM2M ${CMAKE_CURRENT_LIST_DIR}/lwm2m)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_MDNS ${CMAKE_CURRENT_LIST_DIR}/mdns)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_MQTT ${CMAKE_CURRENT_LIST_DIR}/mqtt)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_NAT ${CMAKE_CURRENT_LIST_DIR}/nat)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_POP3 ${CMAKE_CURRENT_LIST_DIR}/pop3)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_PPP ${CMAKE_CURRENT_LIST_DIR}/ppp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_PPPOE ${CMAKE_CURRENT_LIST_DIR}/pppoe)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_PTP ${CMAKE_CURRENT_LIST_DIR}/ptp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_SMTP ${CMAKE_CURRENT_LIST_DIR}/smtp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_SNTP ${CMAKE_CURRENT_LIST_DIR}/sntp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_TELNET ${CMAKE_CURRENT_LIST_DIR}/telnet)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_TFTP ${CMAKE_CURRENT_LIST_DIR}/tftp)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_WEB ${CMAKE_CURRENT_LIST_DIR}/web)
add_subdirectory_ifdef(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_WEBSOCKET ${CMAKE_CURRENT_LIST_DIR}/websocket)